home *** CD-ROM | disk | FTP | other *** search
- %%
- %% This is file `feynmf.mf', generated
- %% on <1994/6/9> with the docstrip utility (2.2h).
- %%
- %% The original source files were:
- %%
- %% feynmf.dtx (with options: `base')
- %%
- %% Copyright (C) 1989, 1990, 1992-1994 by Thorsten.Ohl@Physik.TH-Darmstadt.de
- %%
- %% This file is NOT the source for feynmf, because almost all comments
- %% have been stripped from it. It is NOT the preferred form of feynmf
- %% for making modifications to it.
- %%
- %% Therefore you can NOT redistribute and/or modify THIS file. You can
- %% however redistribute the complete source (feynmf.dtx and feynmf.ins)
- %% and/or modify it under the terms of the GNU General Public License as
- %% published by the Free Software Foundation; either version 2, or (at
- %% your option) any later version.
- %%
- %% Feynmf is distributed in the hope that it will be useful, but
- %% WITHOUT ANY WARRANTY; without even the implied warranty of
- %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- %% GNU General Public License for more details.
- %%
- %% You should have received a copy of the GNU General Public License
- %% along with this program; if not, write to the Free Software
- %% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% \CheckSum{425}
- %% \CharacterTable
- %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
- %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
- %% Digits \0\1\2\3\4\5\6\7\8\9
- %% Exclamation \! Double quote \" Hash (number) \#
- %% Dollar \$ Percent \% Ampersand \&
- %% Acute accent \' Left paren \( Right paren \)
- %% Asterisk \* Plus \+ Comma \,
- %% Minus \- Point \. Solidus \/
- %% Colon \: Semicolon \; Less than \<
- %% Equals \= Greater than \> Question mark \?
- %% Commercial at \@ Left bracket \[ Backslash \\
- %% Right bracket \] Circumflex \^ Underscore \_
- %% Grave accent \` Left brace \{ Vertical bar \|
- %% Right brace \} Tilde \~}
- %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- vardef parse_RCS (suffix RCS) (expr s) =
- save n, c;
- numeric n, RCS[];
- string c;
- RCS[0] := 0;
- for n = 1 upto length (s):
- c := substring (n-1,n) of s;
- exitif ((RCS[0] > 0) and (c = " "));
- if ((c = "0") or (c = "1") or (c = "2")
- or (c = "3") or (c = "4") or (c = "5")
- or (c = "6") or (c = "7") or (c = "8")
- or (c = "9")):
- if RCS[0] = 0:
- RCS[0] := 1;
- RCS[RCS[0]] := 0;
- fi
- RCS[RCS[0]] := 10 * RCS[RCS[0]] + scantokens (c);
- elseif c = ".":
- RCS[0] := RCS[0] + 1;
- RCS[RCS[0]] := 0;
- else:
- fi
- endfor
- enddef;
- vardef require_RCS_revision expr s =
- numeric n;
- save TeX_rev, mf_rev;
- parse_RCS (TeX_rev, s);
- parse_RCS (mf_rev, "1.5");
- for n = 1 upto min (2, TeX_rev[0], mf_rev[0]):
- if TeX_rev[n] > mf_rev[n]:
- errhelp
- "Your version of `feynmf.sty' is higher that of your `feynmf.mf'.";
- errmessage "feynmf: Metafont macros out of date";
- elseif TeX_rev[n] < mf_rev[n]:
- errhelp
- "Your version of `feynmf.mf' is higher that of your `feynmf.sty'.";
- errmessage "feynmf: LaTeX style out of date";
- fi
- exitif (TeX_rev[n] <> mf_rev[n]);
- endfor
- enddef;
- mode_setup;
- thin#:=1pt#; % dimension of the lines
- thick#:=2thin#;
- arrow_width#:=3thick#; % arrows
- arrow_height#:=2arrow_width#;
- curly_len#:=3mm#;
- dash_len#:=3mm#; % 'photon' lines
- dot_len#:=2mm#; % 'photon' lines
- wiggly_len#:=4mm#; % 'photon' lines
- wiggly_slope:=60;
- shade_black#:=1pt#; % shading
- shade_white#:=2shade_black#;
- shade_angle:=60;
- define_blacker_pixels (thick, thin, shade_black, shade_white,
- dash_len, dot_len, wiggly_len, curly_len,
- arrow_height, arrow_width);
- LaTeX_unitlength := mm;
- vardef count (text list) =
- forsuffixes $ = list: + 1 endfor
- enddef;
- vardef getopt (suffix opt) (expr s) =
- numeric opt.first, opt.last, n;
- string opt[], opt[]arg, c;
- boolean argp, escape;
- opt.first := 0;
- opt.last := 0;
- opt[opt.last] := "";
- argp := false;
- escape := false;
- for n = 1 upto length (s):
- c := substring (n-1,n) of s;
- if not escape and (c = ","):
- if substring (n,n+1) of s = ",":
- escape := true;
- else:
- opt.last := opt.last + 1;
- opt[opt.last] := "";
- argp := false;
- fi
- elseif not argp and (c = "="):
- opt[opt.last]arg := "";
- argp := true;
- elseif argp or (c <> " "):
- if argp:
- opt[opt.last]arg := opt[opt.last]arg & c;
- else:
- opt[opt.last] := opt[opt.last] & c;
- fi
- escape := false;
- fi
- endfor
- enddef;
- def save_picture text t =
- save t; picture t; forsuffixes p=t: p:=nullpicture; endfor
- enddef;
- def begin_sketch =
- begingroup save_picture currentpicture;
- sketchlevel := sketchlevel+1;
- enddef;
- def end_sketch =
- sketchlevel := sketchlevel-1;
- sketchpad[sketchlevel] := currentpicture;
- endgroup
- enddef;
- picture sketchpad[];
- sketchlevel := 1;
- vardef use_sketch text t =
- addto currentpicture also (sketchpad[sketchlevel] t)
- enddef;
- vardef shade expr p_arg =
- save x,y,d,p,currentpen; path p; pen currentpen; % push pen!
- pickup pencircle scaled shade_black;
- p = p_arg rotated - shade_angle; % calculate enclosing rectangle
- x2' = x3' = xpart directionpoint up of p; % (rotated by |shade_angle|).
- x1' = x4' = xpart directionpoint down of p;
- y1' = y2' = ypart directionpoint right of p;
- y3' = y4' = ypart directionpoint left of p;
- forsuffixes $=1,2,3,4: z$ = z$' rotated shade_angle; endfor
- d = abs(z1-z4); % height.
- begin_sketch % fill rectangle with lines.
- for k=shade_white/d step (shade_white+shade_black)/d
- until 1 - shade_white/d:
- cutdraw k[z1,z4] -- k[z2,z3];
- endfor
- cullit;
- fill p_arg;
- unfill z1--z2--z3--z4--cycle;
- cullit;
- end_sketch;
- use_sketch;
- enddef;
- vardef arrow =
- clearxy; % push 'em!
- x1 - x2 = arrow_height; y2 - y3 = arrow_width;
- x1 = -3x2; x2 = x3; y1 = y2 + y3 = 0; % center it!
- z1--z2--z3--cycle
- enddef;
- vardef cut_circles (expr diam_a, p_arg, diam_b) =
- subpath (xpart(p_arg intersectiontimes fullcircle scaled diam_a
- shifted point 0 of p_arg),
- xpart(p_arg intersectiontimes fullcircle scaled diam_b
- shifted point infinity of p_arg))
- of p_arg
- enddef;
- vardef make_blob (expr z_arg, diameter) =
- save p,currentpen; path p; pen currentpen;
- pickup pencircle scaled thick;
- p = fullcircle scaled diameter shifted z_arg;
- draw p; shade p;
- enddef;
- vardef draw_blob (expr z_arg, diameter) =
- if sketched_blob_diameter <> diameter: % drawn lately?
- begin_sketch make_blob (origin, diameter); end_sketch; % redo hard work!
- sketched_blob_diameter:= diameter; % record it
- fi
- use_sketch shifted z_arg; % the easy way ...
- enddef;
- def force_new_blob = sketched_blob_diameter := -1; enddef;
- force_new_blob; % initialize it.
- vardef put_on_path (expr o_arg, p_arg) =
- fill o_arg rotated angle direction length(p_arg)/2 of p_arg
- shifted point length(p_arg)/2 of p_arg;
- p_arg
- enddef;
- vardef pixlen (expr p, n) =
- for k=1 upto length(p): + segment_pixlen (subpath (k-1,k) of p, n) endfor
- enddef;
- vardef segment_pixlen (expr p, n) =
- for k=1 upto n: + abs (point k/n of p - point (k-1)/n of p) endfor
- enddef;
- vardef wiggly (expr p_arg) =
- numeric wpp;
- wpp := ceiling (pixlen (p_arg, 10) / (wiggly_len * length(p_arg)));
- for k=0 upto wpp*length(p_arg) - 1:
- point k/wpp of p_arg
- {direction k/wpp of p_arg rotated wiggly_slope} ..
- point (k+.5)/wpp of p_arg
- {direction (k+.5)/wpp of p_arg rotated - wiggly_slope} ..
- endfor
- if cycle p_arg: cycle else: point infinity of p_arg fi
- enddef;
- vardef curly (expr p_arg) =
- numeric cpp;
- cpp := ceiling (pixlen (p_arg, 10) / (curly_len * length(p_arg)));
- if cycle p_arg:
- for k=0 upto cpp*length(p_arg) - 1:
- point (k+.33)/cpp of p_arg
- {direction (k+.33)/cpp of p_arg rotated 90} ..
- point (k-.33)/cpp of p_arg
- {direction (k-.33)/cpp of p_arg rotated -90} ..
- endfor
- cycle
- else:
- point 0 of p_arg
- {direction 0 of p_arg rotated -90} ..
- for k=1 upto cpp*length(p_arg) - 1:
- point (k+.33)/cpp of p_arg
- {direction (k+.33)/cpp of p_arg rotated 90} ..
- point (k-.33)/cpp of p_arg
- {direction (k-.33)/cpp of p_arg rotated -90} ..
- endfor
- point infinity of p_arg
- {direction infinity of p_arg rotated 90}
- fi
- enddef;
- vardef fermion expr path_arg = put_on_path (arrow, path_arg) enddef;
- vardef photon expr path_arg = wiggly (path_arg) enddef;
- vardef gluon expr path_arg = curly (path_arg) enddef;
- save vsty_hash;
- def style_def suffix s =
- vsty_hash.s := 1;
- expandafter quote vardef scantokens ("draw_" & str s)
- enddef;
- vardef vsty_exists suffix s =
- known vsty_hash.s
- enddef;
- vardef valid_style expr s =
- expandafter vsty_exists scantokens (s)
- enddef;
- style_def phantom expr path_arg = \ enddef;
- style_def plain expr p_arg = draw p_arg enddef;
- style_def vanilla expr p_arg = draw p_arg enddef;
- style_def fermion (expr p_arg) = draw fermion (p_arg) enddef;
- style_def quark (expr p_arg) = draw fermion (p_arg) enddef;
- style_def electron (expr p_arg) = draw fermion (p_arg) enddef;
- style_def photon (expr p_arg) = draw photon (p_arg) enddef;
- style_def boson (expr p_arg) = draw photon (p_arg) enddef;
- style_def gluon (expr p_arg) = draw gluon (p_arg) enddef;
- style_def dashes (expr p_arg) =
- numeric dpp;
- dpp := ceiling (pixlen (p_arg, 10) / (dash_len * length(p_arg)));
- for k=0 upto dpp*length(p_arg) - 1:
- draw point k/dpp of p_arg ..
- point (k+.5)/dpp of p_arg;
- endfor
- enddef;
- style_def scalar (expr p_arg) =
- draw_dashes (put_on_path (arrow, p_arg))
- enddef;
- style_def dots (expr p_arg) =
- numeric dpp;
- dpp := ceiling (pixlen (p_arg, 10) / (dot_len * length(p_arg)));
- for k=0 upto dpp*length(p_arg):
- drawdot point k/dpp of p_arg;
- endfor
- enddef;
- style_def ghost (expr p_arg) =
- draw_dots (put_on_path (arrow, p_arg))
- enddef;
- style_def double (expr p_arg) =
- begingroup
- pen oldpen;
- oldpen := currentpen;
- pickup oldpen scaled 3; % draw a thick linn
- draw p_arg;
- pickup oldpen;
- cullit; undraw p_arg; cullit; % and remove the stuffing
- endgroup;
- enddef;
- style_def heavy (expr p_arg) =
- begingroup
- path discard;
- draw_double (p_arg);
- discard = fermion (p_arg);
- endgroup
- enddef;
- tracingstats:=1;
- boolean vtracing;
- vtracing := false; % true
- def vinit =
- save vhash;
- numeric vlist.first, vlist.last;
- vlist.first := 1;
- vlist.last := 0;
- pair vlist[]loc;
- numeric vlist[]arc.first, vlist[]arc.last, vlist[]arc[],
- vlist[]arc[]tns, vlist[]arc[]lbl.dist;
- string vlist[]name, vlist[]lbl, vlist[]arc[]sty, vlist[]arc[]lsr,
- vlist[]arc[]lbl, vlist[]arc[]lbl.side;
- numeric vlist[]lbl.ang, vlist[]lbl.side, vlist[]blob, vlist[]dot;
- enddef;
- def vertices =
- vlist.first upto vlist.last
- enddef;
- def varcs (text i) =
- vlist[i]arc.first upto vlist[i]arc.last
- enddef;
- vardef venter suffix v =
- if not vexists v:
- vlist.last := vlist.last + 1;
- vhash.v := vlist.last;
- vlist[vhash.v]name := str v;
- vlist[vhash.v]loc := (whatever,whatever);
- vlist[vhash.v]arc.first := 1;
- vlist[vhash.v]arc.last := 0;
- vlist[vhash.v]lbl := "";
- vlist[vhash.v]lbl.ang := whatever;
- vlist[vhash.v]lbl.dist := 3;
- vlist[vhash.v]blob := 0;
- vlist[vhash.v]dot := 0;
- fi
- enddef;
- vardef vexists suffix v =
- if known vhash.v: true else: false fi
- enddef;
- vardef vlookup suffix v =
- if vexists v: vhash.v else: 0 fi
- enddef;
- vardef vloc suffix v =
- vlist[vlookup v]loc
- enddef;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- vardef vconnect (expr linesty) (text vl) =
- save from, nfrom, nto, nopt, sty;
- numeric from, nfrom, nto, nopt;
- string sty;
- getopt (opt, linesty);
- sty := opt[opt.first];
- if known opt[opt.first]arg:
- message "feynmf: line styles don't take arguments. "
- & "Argument `" & opt[opt.first]arg & "' ignored.";
- fi
- opt.first := opt.first + 1;
- forsuffixes to = vl:
- venter to;
- nto := vlookup to;
- if known nfrom:
- vlist[nfrom]arc.last := vlist[nfrom]arc.last + 1;
- vlist[nto]arc.last := vlist[nto]arc.last + 1;
- vlist[nfrom]arc[vlist[nfrom]arc.last] := nto;
- vlist[nto]arc[vlist[nto]arc.last] := nfrom;
- vlist[nfrom]arc[vlist[nfrom]arc.last]tns := 1;
- vlist[nto]arc[vlist[nto]arc.last]tns := 1;
- vlist[nfrom]arc[vlist[nfrom]arc.last]lsr := "s";
- vlist[nfrom]arc[vlist[nfrom]arc.last]lbl := "";
- vlist[nfrom]arc[vlist[nfrom]arc.last]lbl.side := "";
- vlist[nfrom]arc[vlist[nfrom]arc.last]lbl.dist := 3;
- for nopt = opt.first upto opt.last:
- if opt[nopt] = "tension":
- get_argument (opt[nopt], scantokens (opt[nopt]arg),
- vlist[nfrom]arc[vlist[nfrom]arc.last]tns);
- get_argument (opt[nopt], scantokens (opt[nopt]arg),
- vlist[nto]arc[vlist[nto]arc.last]tns);
- elseif opt[nopt] = "left":
- vlist[nfrom]arc[vlist[nfrom]arc.last]lsr := "l";
- ignore_argument (opt[nopt], opt[nopt]arg);
- elseif opt[nopt] = "straight":
- vlist[nfrom]arc[vlist[nfrom]arc.last]lsr := "s";
- ignore_argument (opt[nopt], opt[nopt]arg);
- elseif opt[nopt] = "right":
- vlist[nfrom]arc[vlist[nfrom]arc.last]lsr := "r";
- ignore_argument (opt[nopt], opt[nopt]arg);
- elseif opt[nopt] = "label":
- get_argument (opt[nopt], opt[nopt]arg,
- vlist[nfrom]arc[vlist[nfrom]arc.last]lbl);
- elseif opt[nopt] = "side":
- get_argument (opt[nopt], opt[nopt]arg,
- vlist[nfrom]arc[vlist[nfrom]arc.last]lbl.side);
- elseif opt[nopt] = "dist":
- get_argument (opt[nopt], scantokens (opt[nopt]arg),
- vlist[nfrom]arc[vlist[nfrom]arc.last]lbl.dist);
- else:
- ignore_option (opt[nopt], opt[nopt]arg);
- fi
- endfor
- if valid_style sty:
- vlist[nfrom]arc[vlist[nfrom]arc.last]sty := sty;
- else:
- errhelp "feynmf: your linestyle is not recognizable, "
- & "check spelling and reprocess!";
- errmessage "feynmf: line style `" & sty & "' not known, "
- & "replaced by `vanilla'";
- vlist[nfrom]arc[vlist[nfrom]arc.last]sty := "vanilla";
- fi
- vlist[nto]arc[vlist[nto]arc.last]sty := "";
- fi
- nfrom := nto;
- endfor
- enddef;
- vardef get_argument (expr opt, arg) (suffix variable) =
- if known arg:
- variable := arg;
- else:
- message "feynmf: option `" & opt & "' needs an argument. Ignored.";
- fi
- enddef;
- vardef ignore_argument (expr opt, arg) =
- if known arg:
- message "feynmf: option `" & opt & "' doesn't take an argument. "
- & "Argument `" & arg & "' ignored.";
- fi
- enddef;
- vardef ignore_option (expr opt, arg)=
- if known arg:
- message "feynmf: ignoring option " & opt & "=" & arg & ".";
- else:
- message "feynmf: ignoring option " & opt & ".";
- fi
- enddef;
- vardef vcycle (expr sty) (suffix v) (expr n) =
- for $ = 1 upto n - 1:
- vconnect (sty, v[$], v[$+1]);
- endfor
- vconnect (sty, v[n], v[1]);
- enddef;
- vardef circle_left (expr a, b) =
- reverse halfcircle
- rotated angle (b - a)
- scaled abs (a - b)
- shifted .5[a, b]
- enddef;
- vardef vcircle_left (suffix a, b) =
- circle_left (vloc a, vloc b) =
- enddef;
- vardef circle_right (expr a, b) =
- halfcircle
- rotated angle (a - b)
- scaled abs (a - b)
- shifted .5[a, b]
- enddef;
- vardef vcircle_right (suffix a, b) =
- circle_right (vloc a, vloc b) =
- enddef;
- vardef vforce (expr z) (suffix v) =
- venter v;
- vlist[vlookup v]loc := z;
- enddef;
- vardef vshift (expr z) (text vl) =
- forsuffixes $=vl:
- if vexists $:
- vlist[vlookup $]loc := vlist[vlookup $]loc + z;
- fi
- endfor
- enddef;
- vardef vlabel (expr s) (suffix v) =
- venter v;
- vlist[vlookup v]lbl := s;
- enddef;
- vardef vvertex (expr vtxsty) (text vl) =
- save nopt, sty, arg;
- numeric nopt, arg;
- string sty;
- getopt (opt, vtxsty);
- sty := opt[opt.first];
- if known opt[opt.first]arg:
- arg := scantokens (opt[opt.first]arg):
- else:
- arg := .2w;
- fi
- opt.first := opt.first + 1;
- forsuffixes v = vl:
- venter v;
- n := vlookup v;
- if sty = "blob":
- vlist[n]blob := arg;
- vlist[n]dot := 0;
- elseif sty = "dot":
- vlist[n]blob := 0;
- vlist[n]dot := 1;
- fi
- for nopt = opt.first upto opt.last:
- if opt[nopt] = "label":
- get_argument (opt[nopt], opt[nopt]arg, vlist[n]lbl);
- elseif opt[nopt] = "angle":
- get_argument (opt[nopt], scantokens (opt[nopt]arg),
- vlist[n]lbl.ang);
- elseif opt[nopt] = "dist":
- get_argument (opt[nopt], scantokens (opt[nopt]arg),
- vlist[n]lbl.dist);
- else:
- ignore_option (opt[nopt], opt[nopt]arg);
- fi
- endfor
- endfor
- enddef;
- vardef vblob (expr bd) (text vl)=
- forsuffixes $=vl:
- if not vexists $: venter $; fi
- vlist[vlookup $]blob := bd;
- vlist[vlookup $]dot := 0;
- endfor
- enddef;
- vardef vdot (text vl)=
- forsuffixes $=vl:
- if not vexists $: venter $; fi
- vlist[vlookup $]dot := 1;
- vlist[vlookup $]blob := 0;
- endfor
- enddef;
- vardef in_gallery = (.1w,0)..(0,.5h)..(.1w,h) enddef;
- vardef out_gallery = (.9w,0)..(w,.5h)..(.9w,h) enddef;
- vardef surround_gallery =
- superellipse ((w,.5h), (.5w,h), (0,.5h), (.5w,0), .75)
- enddef;
- vardef vincoming (text vl) = vdistribute (in_gallery, vl) enddef;
- vardef voutgoing (text vl) = vdistribute (out_gallery, vl) enddef;
- vardef vsurround (text vl) = vdistribute (surround_gallery, vl) enddef;
- vardef vdistribute (expr p) (text vl) =
- numeric numv, len, off;
- numv := count (vl);
- if cycle p: numv := numv + 1; fi
- len := length (p);
- if numv = 1:
- vforce (point len/2 of p, vl);
- else:
- off := 0;
- forsuffixes $ = vl:
- vforce (point off of p, $);
- off := off + len/(numv-1);
- endfor
- fi
- enddef;
- def vmklist (suffix v) (expr n) =
- for $ = 1 upto n-1: v[$], endfor v[n]
- enddef;
- vardef vincomingn (suffix v) (expr n) =
- vincoming (vmklist (v, n));
- enddef;
- vardef voutgoingn (suffix v) (expr n) =
- voutgoing (vmklist (v, n));
- enddef;
- vardef vsurroundn (suffix v) (expr n) =
- vsurround (vmklist (v, n));
- enddef;
- vardef vdistributen (expr p) (suffix v) (expr n) =
- vdistribute (p, vmklist (v, n))
- enddef;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- vardef vposition =
- for i = vertices:
- if unknown vlist[i]loc:
- origin = origin
- for j = varcs (i):
- + vlist[i]arc[j]tns * (vlist[i]loc - vlist[vlist[i]arc[j]]loc)
- endfor;
- fi
- endfor
- if vtracing: vdump; fi
- enddef;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- vardef vdraw =
- for i = vertices:
- if not known vlist[i]loc:
- errhelp "Your graph specification was not complete (probably a "
- & "lone vertex). Check logic and reprocess!";
- errmessage "feynmf: vertex `" & vlist[i]name & "' not determined, "
- & "replaced by `(0,0)'.";
- vlist[i]loc := origin;
- fi
- endfor
- for i = vertices:
- for j = varcs (i):
- if vlist[i]arc[j]sty <> "":
- vdraw_arc (vlist[i]arc[j]sty,
- cut_circles (vlist[i]blob,
- if vlist[i]arc[j]lsr = "l":
- circle_left (vlist[i]loc,
- vlist[vlist[i]arc[j]]loc)
- elseif vlist[i]arc[j]lsr = "s":
- vlist[i]loc .. vlist[vlist[i]arc[j]]loc
- elseif vlist[i]arc[j]lsr = "r":
- circle_right (vlist[i]loc,
- vlist[vlist[i]arc[j]]loc)
- fi,
- vlist[vlist[i]arc[j]]blob),
- vlist[i]arc[j]lbl,
- vlist[i]arc[j]lbl.side,
- vlist[i]arc[j]lbl.dist);
- fi
- endfor;
- vdraw_vertex_label (vlist[i]loc, vlist[i]lbl,
- vlist[i]lbl.ang, vlist[i]lbl.dist);
- vdraw_vertex_blob (vlist[i]loc, vlist[i]blob);
- endfor
- begingroup
- save currentpen;
- pen currentpen;
- pickup pencircle scaled 2thick;
- for i = vertices:
- vdraw_vertex_dot (vlist[i]loc, vlist[i]dot);
- endfor
- endgroup;
- enddef;
- vardef vdraw_arc (expr sty, arc, lbl, side, dist) =
- scantokens ("draw_" & sty) (arc);
- vdraw_arc_label (arc, lbl, side, dist);
- enddef;
- vardef vdraw_arc_label (expr arc, lbl, side, d) =
- if lbl <> "":
- numeric _a;
- pair _z, _zz, _r;
- _z := point .5 length (arc) of arc;
- _r := direction .5 length (arc) of arc rotated - 90;
- if side = "left":
- _a := angle (-_r);
- elseif side = "right":
- _a := angle (_r);
- else:
- _zz = _z - .5[point 0 of arc, point infinity of arc];
- if ((_zz/length (_zz)) dotprod _r) >= 0:
- _a := angle (_r);
- else:
- _a := angle (-_r);
- fi
- fi
- LaTeX_text (_z + d * thick * dir _a, _a, lbl);
- fi
- enddef;
- vardef vdraw_vertex_label (expr z, lbl, a, d) =
- if lbl <> "":
- numeric _a;
- if unknown a:
- _a := angle (z - .5(w,h));
- else:
- _a := a;
- fi
- LaTeX_text (z + d * thick * dir _a, _a, lbl);
- fi
- enddef;
- vardef vdraw_vertex_blob (expr z, blob) =
- if blob > 0:
- draw_blob (z, blob);
- fi
- enddef;
- vardef vdraw_vertex_dot (expr z, dot) =
- if dot > 0:
- drawdot z;
- fi
- enddef;
- vardef LaTeX expr text =
- message (":" & jobname & "." & decimal charcode & ":" & text & "%%%")
- enddef;
- vardef LaTeX_text (expr z, a, txt) =
- LaTeX "\fmfL(" & (decimal (xpart z/LaTeX_unitlength)) & ","
- & (decimal (ypart z/LaTeX_unitlength)) & ","
- & (voctant a) & "){" & txt & "}";
- enddef;
- vardef voctant expr a =
- voctant_list[floor (a/45 + .5)]
- enddef;
- string voctant_list[];
- voctant_list[-4] := "r";
- voctant_list[-3] := "rt";
- voctant_list[-2] := "t";
- voctant_list[-1] := "lt";
- voctant_list[0] := "l";
- voctant_list[1] := "lb";
- voctant_list[2] := "b";
- voctant_list[3] := "rb";
- voctant_list[4] := "r";
- vardef vdump =
- message ">>>>> Vertices and arcs for diagram #" & decimal charcode
- & " of " & jobname & ".mf:";
- for i = vertices:
- message "> " & vlist[i]name & "=" & decimal_pair (vlist[i]loc)
- & ": #lines="
- & decimal (vlist[i]arc.last - vlist[i]arc.first + 1)
- if vlist[i]blob <> 0:
- & ", blob=" & decimal_ (vlist[i]blob)
- fi
- if vlist[i]dot <> 0:
- & ", dot=" & decimal_ (vlist[i]dot)
- fi
- if vlist[i]lbl <> "":
- & ", lbl=" & vlist[i]lbl
- & ", angle=" & decimal_ (vlist[i]lbl.ang)
- & ", dist=" & decimal_ (vlist[i]lbl.dist)
- fi
- & ".";
- endfor
- for i = vertices:
- for j = varcs (i):
- if vlist[i]arc[j]sty <> "":
- message "> " & vlist[i]name & "*" & vlist[vlist[i]arc[j]]name
- & ": " & vlist[i]arc[j]sty
- & ", tns=" & decimal_ (vlist[i]arc[j]tns)
- & ", lsr=" & vlist[i]arc[j]lsr
- if vlist[i]arc[j]lbl <> "":
- & ", lbl=" & vlist[i]arc[j]lbl
- & ", side=" & vlist[i]arc[j]lbl.side
- & ", dist=" & decimal_ (vlist[i]arc[j]lbl.dist)
- fi
- & ".";
- fi
- endfor
- endfor
- enddef;
- vardef decimal_ (text n) =
- if known n: decimal n else: "?" fi
- enddef;
- vardef decimal_pair (text z) =
- "(" & decimal_ (xpart z) & "," & decimal_ (ypart z) & ")"
- enddef;
- endinput;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \endinput
- %%
- %% End of file `feynmf.mf'.
-